package com.yhk.wuchat.common.common.exception;

import lombok.Data;

/**
 * @version 1.0
 * @Author moresuo
 * @Date 2024/4/9 17:19
 * @注释
 */
@Data
public class BusinessException extends RuntimeException{
    protected Integer errorCode;
    protected String errorMsg;

    public BusinessException(String errorMsg) {
        super(errorMsg);
        this.errorCode=CommonErrorEnum.BUSINESS_ERROR.getCode();
        this.errorMsg = errorMsg;
    }

    public BusinessException(Integer errorCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BusinessException(ErrorEnum errorEnum) {
        super(errorEnum.getMessage());
        this.errorCode = errorEnum.getCode();
        this.errorMsg = errorEnum.getMessage();
    }

}
